mermaid.initialize({ startOnLoad: false });


var container = document.getElementById("mermaid");

chrome.storage.sync.get("procedure", function (result) {
  var procedure = result.procedure;
  console.log(procedure);
  if (!procedure.length) {
    return;
  }
  var str = "graph TD \n";
  procedure.forEach((el, index) => {
    str += `${index}(${el})`;
    if (procedure[index + 1]) {
      str += ` -->${index + 1}(${procedure[index + 1]})\n`;
    }
  });
  container.innerHTML = str;
	mermaid.init({ noteMargin: 1 }, ".mermaid");
});